/*
 * @Author: tomystery 
 * @Date: 2018-05-31 16:49:07 
 * @Last Modified by: t
 * @Last Modified time: 2018-07-15 11:47:17
 */


import React from 'react';
import { BrowserRouter as Router, Route, Redirect, Switch, Link } from 'react-router-dom';

import ProductList from 'page/product/index/index.jsx';
import ProductSave from 'page/product/index/save.jsx';
import ProductDetail from 'page/product/index/detail.jsx';
import categoryList from 'page/product/category/index.jsx';
import categoryAdd from 'page/product/category/add.jsx';


class ProductRouter extends React.Component {
  render() {
    
    return (
        <Switch>
          <Route path="/product/index" component={ProductList} />
          <Redirect  exact from='/product' to='/product/index'/>
          <Route path="/product/save/:pid?" component={ProductSave} />
          <Route path="/product/detail/:pid" component={ProductDetail}/>
          <Route path="/product-category/index/:categoryId?" component={categoryList}/>
          <Route path="/product-category/add" component={categoryAdd}/>

          <Redirect exact from ="/product" to="/product/index"/>
          <Redirect exact from ="/product-category" to="/product-category/index"/>
        </Switch>
    )
  }
}

export default ProductRouter;

